/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author 7P7
 */
@Entity
@Table(name = "Function", catalog = "NationalLevelPaperPresentation", schema = "dbo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Function.findAll", query = "SELECT f FROM Function f"),
    @NamedQuery(name = "Function.findByFuncID", query = "SELECT f FROM Function f WHERE f.funcID = :funcID"),
    @NamedQuery(name = "Function.findByFuncName", query = "SELECT f FROM Function f WHERE f.funcName = :funcName")})
public class Function implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "FuncID", nullable = false)
    private Integer funcID;
    @Size(max = 200)
    @Column(name = "FuncName", length = 200)
    private String funcName;
    @OneToMany(mappedBy = "functionID")
    private Collection<RoleFunction> roleFunctionCollection;

    public Function() {
    }

    public Function(Integer funcID) {
        this.funcID = funcID;
    }

    public Integer getFuncID() {
        return funcID;
    }

    public void setFuncID(Integer funcID) {
        this.funcID = funcID;
    }

    public String getFuncName() {
        return funcName;
    }

    public void setFuncName(String funcName) {
        this.funcName = funcName;
    }

    @XmlTransient
    public Collection<RoleFunction> getRoleFunctionCollection() {
        return roleFunctionCollection;
    }

    public void setRoleFunctionCollection(Collection<RoleFunction> roleFunctionCollection) {
        this.roleFunctionCollection = roleFunctionCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (funcID != null ? funcID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Function)) {
            return false;
        }
        Function other = (Function) object;
        if ((this.funcID == null && other.funcID != null) || (this.funcID != null && !this.funcID.equals(other.funcID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Function[ funcID=" + funcID + " ]";
    }
    
}
